<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Macro BOOST_TYPE_ERASURE_MEMBER</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../boost_typeerasure/reference.html#doxygen.member_8hpp" title="Header &lt;boost/type_erasure/member.hpp&gt;">
<link rel="prev" href="structboost_1_1type__erasure_1_1random__access__iterator.html" title="Struct template random_access_iterator">
<link rel="next" href="structboost_1_1type__erasure_1_1add__assignable.html" title="Struct template add_assignable">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="structboost_1_1type__erasure_1_1random__access__iterator.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost_typeerasure/reference.html#doxygen.member_8hpp"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="structboost_1_1type__erasure_1_1add__assignable.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="doxygen.member_8hpp_1a771e65c5691af968398c9c6c5842475a"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Macro BOOST_TYPE_ERASURE_MEMBER</span></h2>
<p>BOOST_TYPE_ERASURE_MEMBER — Defines a primitive concept for a member function. </p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../boost_typeerasure/reference.html#doxygen.member_8hpp" title="Header &lt;boost/type_erasure/member.hpp&gt;">boost/type_erasure/member.hpp</a>&gt;

</span>BOOST_TYPE_ERASURE_MEMBER(concept_name, member)</pre></div>
<div class="refsect1">
<a name="id-1.3.39.13.24.3.4"></a><h2>Description</h2>
<p>
The declaration of the concept is </p>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Sig</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span> <span class="special">=</span> <span class="identifier">_self</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">concept_name</span><span class="special">;</span>
</pre>
<p> where <code class="computeroutput">Sig</code> is a function type giving the signature of the member function, and <code class="computeroutput">T</code> is the object type. <code class="computeroutput">T</code> may be const-qualified for const member functions. <code class="computeroutput">concept_name&lt;R(A...) const, T&gt;</code> is an alias for <code class="computeroutput">concept_name&lt;R(A...), const T&gt;</code>.</p>
<p>This macro can only be used at namespace scope.</p>
<p>Example:</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="identifier">BOOST_TYPE_ERASURE_MEMBER</span><span class="special">(</span><span class="identifier">push_back</span><span class="special">)</span>
<span class="special">}</span>
<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">has_push_back</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">(</span><span class="keyword">int</span><span class="special">)</span><span class="special">&gt;</span> <span class="identifier">push_back_concept</span><span class="special">;</span>
</pre>
<p>The concept defined by this function may be specialized to provide a concept_map. The class object will be passed by reference as the first parameter.</p>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">has_push_back</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">(</span><span class="keyword">int</span><span class="special">)</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="special">{</span>
  <span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">apply</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span><span class="special">&amp;</span> <span class="identifier">l</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">i</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">l</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">i</span><span class="special">)</span><span class="special">;</span> <span class="special">}</span>
<span class="special">}</span><span class="special">;</span>
</pre>
<p>In C++03, the macro can only be used in the global namespace and is defined as:</p>
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_TYPE_ERASURE_MEMBER</span><span class="special">(</span><span class="identifier">qualified_name</span><span class="special">,</span> <span class="identifier">member</span><span class="special">,</span> <span class="identifier">N</span><span class="special">)</span>
</pre>
<p>Example:</p>
<pre class="programlisting"><span class="identifier">BOOST_TYPE_ERASURE_MEMBER</span><span class="special">(</span><span class="special">(</span><span class="identifier">boost</span><span class="special">)</span><span class="special">(</span><span class="identifier">has_push_back</span><span class="special">)</span><span class="special">,</span> <span class="identifier">push_back</span><span class="special">,</span> <span class="number">1</span><span class="special">)</span>
<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">has_push_back</span><span class="special">&lt;</span><span class="keyword">void</span><span class="special">(</span><span class="keyword">int</span><span class="special">)</span><span class="special">,</span> <span class="identifier">_self</span><span class="special">&gt;</span> <span class="identifier">push_back_concept</span><span class="special">;</span>
</pre>
<p>For backwards compatibility, this form is always accepted. </p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">concept_name</code></span></p></td>
<td><p>is the name of the concept to declare. If it is omitted it defaults to <code class="computeroutput">has_ ## member</code> </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">member</code></span></p></td>
<td><p>is the name of the member function.</p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</div>
</div>
<div class="copyright-footer">Copyright © 2011-2013 Steven Watanabe<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="structboost_1_1type__erasure_1_1random__access__iterator.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost_typeerasure/reference.html#doxygen.member_8hpp"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="structboost_1_1type__erasure_1_1add__assignable.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
